feat(core,github-action): configurable git tag format#242
feat(core,github-action): configurable git tag format#242goulvenclech wants to merge 3 commits intomainfrom
Conversation
🧭 Changeset detectedMerging this PR will release the following updates: sampo (Cargo) — minor version bumpMinor changes
sampo-core (Cargo) — minor version bumpMinor changes
sampo-github-action (Cargo) — minor version bumpMinor changes
|
Princesseuh
left a comment
There was a problem hiding this comment.
I don't think this is the proper solution. Sampo (and similar tools) already kinda suffer from a configuration churn due to having to support a bunch of different setup, and so the default experience should be as seamless:tm: as possible. Pit of success and all that.
I think a better solution, even though it's not intuitive is to instead force users that do encounter the edge case to configure Sampo differently. For instance for Sätteri, publishing would error because it could conflict (even if it doesn't for that specific release), telling me to configure tag_format with perhaps a suggestion.
Closes #190 and #239. Made git tag format configurable via new
tag_formatandshort_tags_formatoptions under[git]. Templates accept{ecosystem},{package_name}, and{version}.sampo publishnow also detects cross-ecosystem tag conflicts: it errors when two packages would produce the same git tag for the release in flight, and warns when packages share a name across ecosystems with a template that doesn't include{ecosystem}(a future version bump would silently collide). Both diagnostics suggest settingtag_format = "{ecosystem}-{package_name}-v{version}"as the fix.What has changed?
sampo publishnow errors when two packages would render to the same git tag for the release in flight, and warns when packages share a name across ecosystems with a template that doesn't include{ecosystem}(a future bump that aligns versions would silently collide). Both diagnostics suggest settingtag_format = "{ecosystem}-{package_name}-v{version}".Config::default().parse_taginstead of its own parser, so a customtag_formatis honoured wherever tags are read back.How is it tested?
Unit tests for
TagTemplate(parsing, rendering, matching, non-ASCII separators, prereleases with-v), config round-trips with both templates set, andcheck_tag_conflictscovering certain-conflict / potential-conflict / silent / short-tags-hint / multi-ecosystem cases. Full workspace: 531 passing.How is it documented?
crates/sampo/README.mddocuments both options and the conflict-detection behaviour with a copy-pasteable fix.